home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / graphics / amicad / arexx_english / align.amicad < prev    next >
Text File  |  1999-12-06  |  1KB  |  59 lines

  1. /* $VER: Align.AmiCAD 1.02e (© R.Florac, 23 mai 1999) */
  2.  
  3. options results
  4.  
  5. signal on error
  6. signal on syntax
  7.  
  8. 'ALIGNEMENT=SELECT("Alignment"+CHR(10)+"Top"+CHR(10)+"Bottom"+CHR(10)+"Left"+CHR(10)+"Right")'
  9. alignement=result
  10. select
  11.     when alignement=1 then ligne_base=50000
  12.     when alignement=2 then ligne_base=0
  13.     when alignement=3 then colonne_base=50000
  14.     when alignement=4 then colonne_base=0
  15.     otherwise exit
  16. end
  17.  
  18. objets=0
  19. 'FIRSTSEL'; i=result
  20. do while i>0
  21.     objets=objets+1
  22.     'LINE('i')'; ligne=result
  23.     'COL('i')'; colonne=result
  24.     select
  25.     when alignement = 1 then do
  26.         if ligne<ligne_base then ligne_base=ligne
  27.     end
  28.     when alignement = 2 then do
  29.         if ligne>ligne_base then ligne_base=ligne
  30.     end
  31.     when alignement = 3 then do
  32.         if colonne<colonne_base then colonne_base=colonne
  33.     end
  34.     otherwise do
  35.         if colonne>colonne_base then colonne_base=colonne
  36.     end
  37.     end
  38.     'NEXTSEL('i')'; i=result
  39. end
  40.  
  41. 'CD='colonne_base':O=FIRSTSEL'; i=result
  42. if alignement=4 then do
  43.     'SAVEALL(-1):O=FIRSTSEL:WHILE(O,MOVE(O,CD-COL(O)-WIDTH(O),0):O=NEXTSEL(O))'
  44.     exit
  45. end
  46.  
  47. 'SAVEALL(-1):O=FIRSTSEL:WHILE(O,IF(ALIGNEMENT<3,MOVE(O,0,'ligne_base'-LINE(O)),MOVE(O,'colonne_base'-COL(O),0)):O=NEXTSEL(O))'
  48.  
  49. exit
  50.  
  51. syntax:
  52. erreur=RC
  53. 'MESSAGE("Syntax error"+CHR(10)+"in line 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  54. exit
  55.  
  56. error:
  57. 'MESSAGE("Error in line 'SIGL'")'
  58. exit
  59.